#include "test_uart.h"

bsp_gpio_init_t gpio_uart2_tx = {
    1,//0:GPIOA,1:GPIOB
    2,//x:PINx
    1,//0:intput,1:output,reserve,not support;
    2,//0:Anolog,1:input,2:pushpull,3:OD
    0,//reserve,not support;
    0,//0:GPIO_IT_NONE,1:GPIO_IT_RISING,2:GPIO_IT_FALLING
    0,//0:GPIO_PULL_NONE,1:GPIO_PULL_UP
    1,//af1
};
bsp_gpio_init_t gpio_uart2_rx = {
    1,//0:GPIOA,1:GPIOB
    3,//x:PINx
    0,//0:intput,1:output,reserve,not support;
    1,//0:Anolog,1:input,2:pushpull,3:OD
    0,//reserve,not support;
    0,//0:GPIO_IT_NONE,1:GPIO_IT_RISING,2:GPIO_IT_FALLING
    0,//0:GPIO_PULL_NONE,1:GPIO_PULL_UP
    1,//af1
};
bsp_uart_init_t uart2 = {
    1,//0:UART1,1:UART2
    &gpio_uart2_tx,
    &gpio_uart2_rx,
    115200,//baudrate
    0,//stopbit,0:1bit,1:1.5bit,2:2bit
    0,//firstbit,0:LSB,1:MSB
    0,//startedge,0:UART_RXDSTART_FALL,1:UART_RXDSTART_LOW
    0,//0:PARITY_NONE,1:PARITY_EVEN,2:PARITY_ODD,3:PARITY_CUSTOM
    0,//0:8bit,1:9bit
    0,//0:UART_HWCONTROL_NONE,1:UART_HWCONTROL_RTS,2:UART_HWCONTROL_CTS,3:UART_HWCONTROL_RTS_CTS
    uart2_txbuf,
    uart2_rxbuf,
};
void uart_test_init(void)
{
    bsp_uart_init(&uart2);
}

void uart_test(void)
{
    bsp_uart_send(&uart2, "hello world\r\n", 13);
}

